/*
Replication data set for: 

Joseph Wright. 2008. ``Do Authoritarian Institutions Constrain? How Legislatures Affect 
	Economic Growth and Investment.'' American Journal of Political Science. 52(2)


Author: Joseph Wright
Affiliation: Princeton University
Date: April 20, 2008
*/
* Wright_AJPS08

use "Wright08AJPSreplicate.dta", clear

replace country = "Central African Republic" if country=="Cen African Rep"
replace country = "Dominican Republic" if country=="Dominican Rep"
replace country = "Cote D'Ivoire" if country=="Ivory Coast"
replace country = "North Korea" if country=="Korea North"
replace country = "South Korea" if country=="Korea South"
replace country = "East Germany" if country=="Germany East"
replace country = "United Arab Emirates" if country=="UAE"
replace country = "Yemen, Republic" if country=="Yemen"
replace country = "Congo, Republic" if country=="Congo Brazzaville"
replace country = "Congo, Dem. Republic" if country=="Congo Kinshasa"
replace country = "Yemen, Pdr" if country=="South Yemen"
ccode country, from(cty) to(cow) gen(ccode)
replace ccode = 364 if country=="Soviet Union"
replace ccode = 347 if country=="Serbia and Montenegro"
replace ccode = 817 if country=="South Vietnam"

 sort ccode year
merge m:1 ccode using gattlist.dta 
drop if _m==2 
drop _merge
sort ccode year
merge m:1 ccode using wtolist.dta 
drop if _m==2 
drop _merge

gen gatt = year>=gattjoin
gen wto = year>=wtojoin
gen gattwto = gatt==1 | wto==1

gen study = ""
foreach n in orig noth fe time fet ct yfe cyfe {
gen method_`n' = ""
gen dv_`n' = ""
gen b_gatt_`n' = .
gen se_gatt_`n'= .
gen pval_gatt_`n' = .
gen lo_gatt_`n'=.
gen hi_gatt_`n'=.
gen N_gatt_`n'=.
}
gen studynum=.
gen timetrend=""
qui do gatt.do

local ii = 1
 
**Generate
gen MIL =military==1 | milpers==1 if military~=.
gen SPARTY =sparty==1 | spmil==1 | sppers==1 | tthreat==1 if sparty~=.
mkspline spline 5 = lifetime
gen LogReserves = log(L_PC_RESERVES +1)

**REGIMES**
* model 1
mlogit regtype LogReserves lifetime  gattwto                  lgdp_  ethfrac LogPopulation  islam        colony_br colony_sp colony_fr colony_p d19* , robust
replace b_gatt_orig= _b[0:gattwto] if _n==`ii'
replace se_gatt_orig = _se[0:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[0:gattwto]/_se[0:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[0:gattwto]-(_se[0:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[0:gattwto]+(_se[0:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'   
replace timetrend="decdum" if _n==`ii'
local ii=`ii'+1
replace b_gatt_orig= _b[1:gattwto] if _n==`ii'
replace se_gatt_orig = _se[1:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[1:gattwto]/_se[1:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[1:gattwto]-(_se[1:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[1:gattwto]+(_se[1:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'   
replace timetrend="decdum" if _n==`ii'
local ii=`ii'+1

replace b_gatt_orig= _b[2:gattwto] if _n==`ii'
replace se_gatt_orig = _se[2:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[2:gattwto]/_se[2:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[2:gattwto]-(_se[2:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[2:gattwto]+(_se[2:gattwto]*invnormal(.975)) if _n==`ii' 
replace studynum = `ii' if _n==`ii'   
replace timetrend="decdum" if _n==`ii'
local ii=`ii'+1 

* model 2
mlogit regtype LogOil lifetime gattwto lgdp_  ethfrac LogPopulation  islam colony_br colony_sp colony_fr colony_p d19* , robust
replace b_gatt_orig= _b[0:gattwto] if _n==`ii'
replace se_gatt_orig = _se[0:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[0:gattwto]/_se[0:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[0:gattwto]-(_se[0:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[0:gattwto]+(_se[0:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'   
replace timetrend="decdum" if _n==`ii'
local ii=`ii'+1
replace b_gatt_orig= _b[1:gattwto] if _n==`ii'
replace se_gatt_orig = _se[1:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[1:gattwto]/_se[1:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[1:gattwto]-(_se[1:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[1:gattwto]+(_se[1:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'   
replace timetrend="decdum" if _n==`ii'
local ii=`ii'+1

replace b_gatt_orig= _b[2:gattwto] if _n==`ii'
replace se_gatt_orig = _se[2:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[2:gattwto]/_se[2:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[2:gattwto]-(_se[2:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[2:gattwto]+(_se[2:gattwto]*invnormal(.975)) if _n==`ii'  
replace studynum = `ii' if _n==`ii'   
replace timetrend="decdum" if _n==`ii'
local ii=`ii'+1
* model 3
mlogit regtype lifetime gattwto InvestGDP_impute lgdp_ ethfrac LogPopulation islam colony_br colony_sp colony_fr colony_p d19* , robust
replace b_gatt_orig= _b[0:gattwto] if _n==`ii'
replace se_gatt_orig = _se[0:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[0:gattwto]/_se[0:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[0:gattwto]-(_se[0:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[0:gattwto]+(_se[0:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'   
replace timetrend="decdum" if _n==`ii'
local ii=`ii'+1
replace b_gatt_orig= _b[1:gattwto] if _n==`ii'
replace se_gatt_orig = _se[1:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[1:gattwto]/_se[1:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[1:gattwto]-(_se[1:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[1:gattwto]+(_se[1:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'   
replace timetrend="decdum" if _n==`ii'
local ii=`ii'+1

replace b_gatt_orig= _b[2:gattwto] if _n==`ii'
replace se_gatt_orig = _se[2:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[2:gattwto]/_se[2:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[2:gattwto]-(_se[2:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[2:gattwto]+(_se[2:gattwto]*invnormal(.975)) if _n==`ii'  
replace studynum = `ii' if _n==`ii'   
replace timetrend="decdum" if _n==`ii'
local ii=`ii'+1

* model 4
mlogit regtype LogReserves lifetime  gattwto InvestGDP_impute lgdp_  ethfrac LogPopulation  islam gulf   colony_br colony_sp colony_fr colony_p d19*   , robust
replace b_gatt_orig= _b[0:gattwto] if _n==`ii'
replace se_gatt_orig = _se[0:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[0:gattwto]/_se[0:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[0:gattwto]-(_se[0:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[0:gattwto]+(_se[0:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'   
replace timetrend="decdum" if _n==`ii'
local ii=`ii'+1
replace b_gatt_orig= _b[1:gattwto] if _n==`ii'
replace se_gatt_orig = _se[1:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[1:gattwto]/_se[1:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[1:gattwto]-(_se[1:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[1:gattwto]+(_se[1:gattwto]*invnormal(.975)) if _n==`ii'    
replace studynum = `ii' if _n==`ii'   
replace timetrend="decdum" if _n==`ii'
local ii=`ii'+1

replace b_gatt_orig= _b[2:gattwto] if _n==`ii'
replace se_gatt_orig = _se[2:gattwto]  if _n==`ii'
replace pval_gatt_orig= 2*normal(-abs(_b[2:gattwto]/_se[2:gattwto]))  if _n==`ii'
replace method_orig = "`e(cmd)'" if _n==`ii'
replace dv_orig = "`:word 2 of `e(cmdline)''" if _n==`ii'
replace lo_gatt_orig = _b[2:gattwto]-(_se[2:gattwto]*invnormal(.975)) if _n==`ii'
replace hi_gatt_orig = _b[2:gattwto]+(_se[2:gattwto]*invnormal(.975)) if _n==`ii'  
replace studynum = `ii' if _n==`ii'   
replace timetrend="decdum" if _n==`ii'
local ii=`ii'+1

predict p0 p1 p2 p3  if e(sample)
replace p1=.99 if p1==1  /*to avoid log(1)=0: p1 is approx. and may vary depending on the estimating routine*/
gen trnsp0=(p0*ln(p0))/(1-p0)
gen trnsp1=(p1*ln(p1))/(1-p1)
gen trnsp2=(p2*ln(p2))/(1-p2)
gen trnsp3=(p3*ln(p3))/(1-p3)
gen lambda_mon= 3*ln(p1)+ trnsp0 +trnsp2 +trnsp3
gen lambda_mil= 3*ln(p2)+ trnsp0 +trnsp1 +trnsp3
gen lambda_sp= 3*ln(p3)+ trnsp0 +trnsp1 +trnsp2
drop p0 p1 p2 p3 trnsp* 


**Generate interaction terms**
gen SPARTYtimehorizon = SPARTY*TimeHorizon
gen MILtimehorizon = MIL*TimeHorizon
gen monarchtimehorizon = monarch*TimeHorizon
gen SPARTYloggdp = SPARTY*LogGDP_rescale
gen MILloggdp = MIL*LogGDP_rescale
gen monarchloggdp = monarch*LogGDP_rescale
gen SPARTYLogOil = SPARTY*LogOil_nomissing
gen MILLogOil = MIL*LogOil_nomissing
gen monarchLogOil = monarch*LogOil_nomissing
gen SPARTYlogpop = SPARTY*LogPopulation_rescale
gen MILlogpop = MIL*LogPopulation_rescale
gen monarchlogpop = monarch*LogPopulation_rescale

**LEGISLATURES**  \* originally estimated with <robust> and <vce(boot)> as options, but newer STATA versions don't allow both options*\
* model 5
probit legislature TimeHorizon gattwto SPARTYtimehorizon MILtimehorizon monarchtimehorizon LogGDP_rescale SPARTYloggdp MILloggdp monarchloggdp ///
   LogOil_nomissing SPARTYLogOil MILLogOil monarchLogOil LogPopulation_rescale SPARTYlogpop MILlogpop monarchlogpop  lifetime SPARTY MIL monarch ///
   lambda_mon lambda_mil lambda_sp, robust  
gatt `ii' orig
probit legislature TimeHorizon gattwto SPARTYtimehorizon MILtimehorizon monarchtimehorizon LogGDP_rescale SPARTYloggdp MILloggdp monarchloggdp ///
   LogOil_nomissing SPARTYLogOil MILLogOil monarchLogOil LogPopulation_rescale SPARTYlogpop MILlogpop monarchlogpop   SPARTY MIL monarch  ///
   lambda_mon lambda_mil lambda_sp, robust  
gatt `ii' noth
xtlogit legislature TimeHorizon gattwto SPARTYtimehorizon MILtimehorizon monarchtimehorizon LogGDP_rescale SPARTYloggdp MILloggdp monarchloggdp ///
  LogOil_nomissing SPARTYLogOil MILLogOil monarchLogOil LogPopulation_rescale SPARTYlogpop MILlogpop monarchlogpop SPARTY MIL monarch ///
  lambda_mon lambda_mil lambda_sp, fe  
gatt `ii' fe
probit legislature TimeHorizon gattwto SPARTYtimehorizon MILtimehorizon monarchtimehorizon LogGDP_rescale SPARTYloggdp MILloggdp monarchloggdp ///
  LogOil_nomissing SPARTYLogOil MILLogOil monarchLogOil LogPopulation_rescale SPARTYlogpop MILlogpop monarchlogpop  lifetime SPARTY MIL monarch ///
  lambda_mon lambda_mil lambda_sp, robust  
gatt `ii' time
xtlogit legislature TimeHorizon gattwto SPARTYtimehorizon MILtimehorizon monarchtimehorizon LogGDP_rescale SPARTYloggdp MILloggdp monarchloggdp ///
  LogOil_nomissing SPARTYLogOil MILLogOil monarchLogOil LogPopulation_rescale SPARTYlogpop MILlogpop monarchlogpop lifetime SPARTY MIL monarch ///
  lambda_mon lambda_mil lambda_sp, fe  
gatt `ii' fet
logit legislature TimeHorizon gattwto SPARTYtimehorizon MILtimehorizon monarchtimehorizon LogGDP_rescale SPARTYloggdp MILloggdp monarchloggdp ///
  LogOil_nomissing SPARTYLogOil MILLogOil monarchLogOil LogPopulation_rescale SPARTYlogpop MILlogpop monarchlogpop lifetime SPARTY MIL monarch ///
   lambda_mon lambda_mil lambda_sp i.ccode#c.year, cl(ccode)    
gatt `ii' ct
xtreg legislature TimeHorizon gattwto SPARTYtimehorizon MILtimehorizon monarchtimehorizon LogGDP_rescale SPARTYloggdp MILloggdp monarchloggdp ///
  LogOil_nomissing SPARTYLogOil MILLogOil monarchLogOil LogPopulation_rescale SPARTYlogpop MILlogpop monarchlogpop SPARTY MIL monarch ///
  lambda_mon lambda_mil lambda_sp i.year, fe   vce(cl ccode)
gatt `ii' cyfe
clogit legislature TimeHorizon gattwto SPARTYtimehorizon MILtimehorizon monarchtimehorizon LogGDP_rescale SPARTYloggdp MILloggdp monarchloggdp ///
  LogOil_nomissing SPARTYLogOil MILLogOil monarchLogOil LogPopulation_rescale SPARTYlogpop MILlogpop monarchlogpop SPARTY MIL monarch ///
  lambda_mon lambda_mil lambda_sp, group(year)   vce(cl year)
gatt `ii' yfe
replace studynum = `ii' if _n==`ii'   
replace timetrend="year" if _n==`ii'

local ii=`ii'+1

gen GROWTH= growth*100
*egen ccode = group(country)
tsset ccode year, yearly

***************************************************
gen noleg = legislature==0
gen MILleg = MIL*legislature
gen SPARTYleg = SPARTY*legislature
gen monarchleg= monarch*legislature
gen MILnoleg = MIL*noleg
gen SPARTYnoleg = SPARTY*noleg
gen monarchnoleg = monarch*noleg
gen meast_ = meast==1 | nafrica==1

***Growth***
* model 6
xtpcse  GROWTH  legislature gattwto  MIL  SPARTY  monarch    colony_br  lgdp_ ssafr ethfrac  InvestGDP GovtC Inflation d196 d197, pairwise  corr(psar1) het
gatt `ii' orig
xtpcse  GROWTH  legislature gattwto  MIL  SPARTY  monarch    colony_br  lgdp_ ssafr ethfrac  InvestGDP GovtC Inflation , pairwise  corr(psar1) het
gatt `ii' noth
xtpcse  GROWTH  legislature gattwto  MIL  SPARTY  monarch    colony_br  lgdp_ ssafr ethfrac  InvestGDP GovtC Inflation  i.ccode, pairwise  corr(psar1) het
gatt `ii' fe
xtpcse  GROWTH  legislature gattwto  MIL  SPARTY  monarch    colony_br  lgdp_ ssafr ethfrac  InvestGDP GovtC Inflation d196 d197, pairwise  corr(psar1) het
gatt `ii' time
xtpcse  GROWTH  legislature gattwto  MIL  SPARTY  monarch    colony_br  lgdp_ ssafr ethfrac  InvestGDP GovtC Inflation d196 d197 i.ccode, pairwise  corr(psar1) het
gatt `ii' fet
xtpcse  GROWTH  legislature gattwto  MIL  SPARTY  monarch    colony_br  lgdp_ ssafr ethfrac  InvestGDP GovtC Inflation  i.ccode#c.year , pairwise  corr(psar1) het
gatt `ii' ct
xtpcse  GROWTH  legislature gattwto  MIL  SPARTY  monarch    colony_br  lgdp_ ssafr ethfrac  InvestGDP GovtC Inflation  i.ccode i.year, pairwise  corr(psar1) het
gatt `ii' cyfe
xtpcse  GROWTH  legislature gattwto  MIL  SPARTY  monarch    colony_br  lgdp_ ssafr ethfrac  InvestGDP GovtC Inflation  i.year, pairwise  corr(psar1) het
gatt `ii' yfe
replace studynum = `ii' if _n==`ii'   
replace timetrend="decdum" if _n==`ii'
local ii=`ii'+1

* model 7
xtpcse  GROWTH  legislature gattwto  MILleg MILnoleg  SPARTYleg SPARTYnoleg  monarchleg monarchnoleg  colony_br  lgdp_ ssafr ethfrac  InvestGDP ///
   GovtC Inflation d196 d197 cacar samerica meast_ casia easia, pairwise  corr(psar1) het
gatt `ii' orig
xtpcse  GROWTH  legislature gattwto  MILleg MILnoleg  SPARTYleg SPARTYnoleg  monarchleg monarchnoleg  colony_br  lgdp_ ssafr ethfrac  InvestGDP ///
   GovtC Inflation cacar samerica meast_ casia easia, pairwise  corr(psar1) het
gatt `ii' noth
xtpcse  GROWTH  legislature gattwto  MILleg MILnoleg  SPARTYleg SPARTYnoleg  monarchleg monarchnoleg  colony_br  lgdp_ ssafr ethfrac  InvestGDP ///
   GovtC Inflation cacar samerica meast_ casia easia i.ccode , pairwise  corr(psar1) het
gatt `ii' fe
xtpcse  GROWTH  legislature gattwto  MILleg MILnoleg  SPARTYleg SPARTYnoleg  monarchleg monarchnoleg  colony_br  lgdp_ ssafr ethfrac  InvestGDP ///
   GovtC Inflation d196 d197 cacar samerica meast_ casia easia, pairwise  corr(psar1) het
gatt `ii' time 
xtpcse  GROWTH  legislature gattwto  MILleg MILnoleg  SPARTYleg SPARTYnoleg  monarchleg monarchnoleg colony_br  lgdp_ ssafr ethfrac  InvestGDP GovtC Inflation ///
  cacar samerica meast_ casia easia d196 d197 i.ccode, pairwise  corr(psar1) het
gatt `ii' fet
xtpcse  GROWTH  legislature gattwto  MILleg MILnoleg  SPARTYleg SPARTYnoleg  monarchleg monarchnoleg  colony_br  lgdp_ ssafr ethfrac  InvestGDP GovtC Inflation ///
  cacar samerica meast_ casia easia i.ccode#c.year, pairwise  corr(psar1) het
  gatt `ii' ct
  xtpcse  GROWTH  legislature gattwto  MILleg MILnoleg  SPARTYleg SPARTYnoleg  monarchleg monarchnoleg  colony_br  lgdp_ ssafr ethfrac  InvestGDP ///
   GovtC Inflation cacar samerica meast_ casia easia i.ccode i.year , pairwise  corr(psar1) het
gatt `ii' cyfe
xtpcse  GROWTH  legislature gattwto  MILleg MILnoleg  SPARTYleg SPARTYnoleg  monarchleg monarchnoleg  colony_br  lgdp_ ssafr ethfrac  InvestGDP ///
   GovtC Inflation cacar samerica meast_ casia easia i.year , pairwise  corr(psar1) het
gatt `ii' yfe
replace studynum = `ii' if _n==`ii'   
replace timetrend="decdum" if _n==`ii'
local ii=`ii'+1


***Investment***
* model 8
xtpcse InvestGDP legislature gattwto MILleg MILnoleg   SPARTYleg SPARTYnoleg monarchleg monarchnoleg  lgdp_  LifeExp, pairwise corr(ar1) het
gatt `ii' orig
xtpcse InvestGDP legislature gattwto MILleg MILnoleg   SPARTYleg SPARTYnoleg monarchleg monarchnoleg  lgdp_  LifeExp, pairwise corr(ar1) het
gatt `ii' noth
xtpcse InvestGDP legislature gattwto MILleg MILnoleg   SPARTYleg SPARTYnoleg monarchleg monarchnoleg  lgdp_  LifeExp i.ccode, pairwise corr(ar1) het
gatt `ii' fe
xtpcse InvestGDP legislature gattwto MILleg MILnoleg   SPARTYleg SPARTYnoleg monarchleg monarchnoleg  lgdp_  LifeExp year, pairwise corr(ar1) het
gatt `ii' time
xtpcse InvestGDP legislature gattwto MILleg MILnoleg   SPARTYleg SPARTYnoleg monarchleg monarchnoleg lgdp_  LifeExp year i.ccode, pairwise corr(ar1) het
gatt `ii' fet
xtpcse InvestGDP legislature gattwto MILleg MILnoleg   SPARTYleg SPARTYnoleg monarchleg monarchnoleg  lgdp_  LifeExp i.ccode#c.year, pairwise corr(ar1) het
gatt `ii' ct
xtpcse InvestGDP legislature gattwto MILleg MILnoleg   SPARTYleg SPARTYnoleg monarchleg monarchnoleg  lgdp_  LifeExp i.ccode i.year, pairwise corr(ar1) het
gatt `ii' cyfe
xtpcse InvestGDP legislature gattwto MILleg MILnoleg   SPARTYleg SPARTYnoleg monarchleg monarchnoleg  lgdp_  LifeExp i.year, pairwise corr(ar1) het
gatt `ii' yfe
replace studynum = `ii' if _n==`ii'   
local ii=`ii'+1

* model 9
xtpcse InvestGDP  legislature gattwto MILleg MILnoleg   SPARTYleg SPARTYnoleg monarchleg monarchnoleg  lgdp_ LifeExp ssa easia meast_ samerica casia cacar d19*, pairwise corr(ar1) het 
gatt `ii' orig
xtpcse InvestGDP  legislature gattwto MILleg MILnoleg   SPARTYleg SPARTYnoleg monarchleg monarchnoleg  lgdp_ LifeExp ssa easia meast_ samerica casia cacar , pairwise corr(ar1) het 
gatt `ii' noth
xtpcse InvestGDP  legislature gattwto MILleg MILnoleg   SPARTYleg SPARTYnoleg monarchleg monarchnoleg  lgdp_ LifeExp ssa easia meast_ samerica ///
 casia cacar  i.ccode, pairwise corr(ar1) het 
gatt `ii' fe
xtpcse InvestGDP  legislature gattwto MILleg MILnoleg   SPARTYleg SPARTYnoleg monarchleg monarchnoleg  lgdp_ LifeExp ssa easia meast_ samerica ///
 casia cacar d19*, pairwise corr(ar1) het 
gatt `ii' time
xtpcse InvestGDP  legislature gattwto MILleg MILnoleg   SPARTYleg SPARTYnoleg monarchleg monarchnoleg  lgdp_ LifeExp ssa easia meast_ samerica ///
 casia cacar d19* i.ccode, pairwise corr(ar1) het 
gatt `ii' fet
xtpcse InvestGDP  legislature gattwto MILleg MILnoleg   SPARTYleg SPARTYnoleg monarchleg monarchnoleg  lgdp_ LifeExp ssa easia meast_ samerica ///
 casia cacar i.ccode#c.year, pairwise corr(ar1) het 
gatt `ii' ct
xtpcse InvestGDP  legislature gattwto MILleg MILnoleg   SPARTYleg SPARTYnoleg monarchleg monarchnoleg  lgdp_ LifeExp ssa easia meast_ samerica ///
 casia cacar  i.ccode i.year , pairwise corr(ar1) het 
gatt `ii' cyfe
 xtpcse InvestGDP  legislature gattwto MILleg MILnoleg   SPARTYleg SPARTYnoleg monarchleg monarchnoleg  lgdp_ LifeExp ssa easia meast_ samerica ///
 casia cacar  i.year, pairwise corr(ar1) het 
gatt `ii' yfe
replace studynum = `ii' if _n==`ii'   
replace timetrend="decdum" if _n==`ii'
local ii=`ii'+1
replace study = "Wright 2008" if studynum~=. 	

keep study-timetrend
drop if studynum==.
compress
save wright2008.dta , replace
